import request from "@/utils/request";

// 定义类型
export interface trademarkItemType {
    id?: number,
    tmName: string,
    logoUrl: string
}
export type trademarkListType = trademarkItemType[];
//品牌分页列表请求的信息类型
export interface trademarkInfoType {
    records: trademarkListType;
    total: number;
    size: number;
    current: number;
    searchCount: boolean;
    pages: number;
}

//1. 请求品牌的分页列表
export const reqTrademarkInfo = (page: number, limit: number) => {
    return request.get<null, trademarkInfoType>(
        `/admin/product/baseTrademark/${page}/${limit}`
    );
};

// 2、新增品牌列表  POST /admin/product/baseTrademark/save
export const reqAddTrademark = (tmInfo: trademarkItemType) => {
  return request.post(`/admin/product/baseTrademark/save`,tmInfo)
}

//3. 修改品牌接口  PUT /admin/product/baseTrademark/update
export const reqUpdateTradmark = (tmInfo: trademarkItemType) => {
  return request.put<null, null>(`/admin/product/baseTrademark/update`, tmInfo);
};

//4. 删除品牌  DELETE /admin/product/baseTrademark/remove/{id}
export const reqDeleteTrademark = (id: number) => {
  return request.delete<null, null>(
    `/admin/product/baseTrademark/remove/${id}`
  );
};